<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/lib/jquery.min.js"></script>
    <title>ng-init与ng-trim及表单中表单value</title>
    <style>
        .ng-cloak{
            display: none;
        }
    </style>
</head>
<body>
<div ng-app="tinywan" ng-controller="ctrl" ng-init="name='Tinywan'">
    <h1>{{name}}</h1>
    <form action="{:U('AngularJS/angular_json_string_form')}" method="post">
        标题：<input type="text" name="title" ng-model="title"><br/>
        内容显示：<input type="text" name="data"><br/>
        <input type="submit" value="Submit">
    </form>
</div>

<script>
    var module = angular.module('tinywan', []);
    module.controller('ctrl', ['$scope', function ($scope) {
        $scope.title = '';
        $('form').submit(function () {
            $("[name='data']").val($scope.title);
        });

    }]);
</script>
</body>
</html>


